/*
 * Copyright (c) 2023.
 *
 * 作者：bmy
 * 邮箱：2271608011@qq.com
 * gitee：https://gitee.com/bmycode
 * github：https://github.com/helpcode
 *
 */

import { Window } from '@tauri-apps/plugin-window';
import { editor } from "monaco-editor";

export interface themeType {
  background: string;
  color: string;
  activeBackgroundColor: string;
}

interface configType {
  giteeApi: {
    releasesUrl: string;
    starUser: string
  };
  JsonDom: editor.IStandaloneCodeEditor | null;
  ClassOrInterface: editor.IStandaloneCodeEditor | null;
  light: themeType;
  dark: themeType;
  appWindow: Window,
  os: Window,
  offOrOnList: (ags?: number) => Record<string, string>[]
}

const config: configType = {
  giteeApi: {
    releasesUrl: "https://gitee.com/api/v5/repos/bmycode/json-class-desktop/releases/latest",
    starUser: "https://gitee.com/api/v5/repos/bmycode/json-class-desktop/stargazers?page=1&per_page=20"
  },
  JsonDom: null,
  ClassOrInterface: null,
  // @ts-ignore
  appWindow: window.__TAURI__.window.getCurrent(),
  os: window.__TAURI__.os,
  light: {
    // background: "#d5d0d0",
    background: "rgba(213, 208, 208, 0.6)",
    color: "#000",
    activeBackgroundColor: "#fff"
  },
  dark: {
    // background: "#252526",
    background: "rgba(0, 0, 0, 0.6)",
    color: "#bdbdbd",
    activeBackgroundColor: "#1e1e1e"
  },
  offOrOnList: (type: number = 0) => {
    switch (type) {
      case 0:
        return [
          { label: "开启", value: "1" },
          { label: "关闭", value: "0" }
        ]
      case 1:
        return  [
          { label: "class", value: "0" },
          { label: "interface", value: "1" }
        ]
      case 2:
        return  [
          { label: "开启", value: "on" },
          { label: "关闭", value: "off" }
        ]
    }
    return []
  }
}

export default config